# Contributor: Valery Kartel <valery.kartel@gmail.com>
# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer: Carlo Landmeter <clandmeter@gmail.com>
pkgname=lftp
pkgver=4.9.2
pkgrel=0
pkgdesc="Sophisticated ftp/http client"
url="https://lftp.tech"
arch="all"
license="GPL-3.0-or-later"
makedepends="zlib-dev openssl-dev readline-dev ncurses-dev"
subpackages="$pkgname-doc"
source="https://lftp.yar.ru/ftp/lftp-$pkgver.tar.xz"

# secfixes:
#   4.8.4-r0:
#     - CVE-2018-10916

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--with-openssl \
		--with-modules \
		--disable-nls \
		--disable-static \
		--enable-threads=posix
	make
}

package() {
	make -j1 install DESTDIR="$pkgdir"
	rm -f "$pkgdir"/usr/lib/charset.alias
	mkdir -p "$pkgdir"/usr/share/doc/$pkgname
	mv "$pkgdir"/usr/share/$pkgname "$pkgdir"/usr/share/doc/
}

check() {
	# skip ftp tests due to firewall issues
	make -C tests check check_PROGRAMS=http-get
}

sha512sums="cda8698e7e34d748715a6fe5dc06c758240302621c7957402f0cc67577acf1a96b436fda4282408dee8171dc84a31e0be432df99a30f0a10057a8e7ea9ec64ad  lftp-4.9.2.tar.xz"
